package com.xbb.kafka.Interceptor;

import org.apache.kafka.clients.producer.*;

import java.util.Map;

public class AddTimeInterceptor implements ProducerInterceptor<String, String> {

  @Override
  public ProducerRecord<String, String> onSend(ProducerRecord<String, String> record) {
    String value = System.currentTimeMillis() + "," + record.value();
    return new ProducerRecord<>(record.topic(), record.partition(), record.key(), value);
  }

  @Override
  public void onAcknowledgement(RecordMetadata metadata, Exception exception) {

  }

  @Override
  public void close() {

  }

  @Override
  public void configure(Map<String, ?> configs) {

  }
}
